<?php

/**
 * render newsletter form
 */
//import model
//Yii::import('common.models.subscriber.Subscriber');
class WNewsletterForm extends CWidget {

    public $action = '';
    public $requireName = TRUE;

    public function init() {
	parent::init();

	//set default action
	if ($this->action == '') {
	    $this->action = url('/site/newsletter');
	}
	//register js
	$cs = Yii::app()->clientScript;
	$cs->registerCoreScript('jquery');
	$cs->registerScriptFile(Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.widgets.newsletter.assets') . DIRECTORY_SEPARATOR . 'newsletter.js'), CClientScript::POS_END);
    }

    public function run() {
	//
	$model = new Subscriber();
	$this->render('form', array(
	    'model' => $model
	));
    }

}

